import { request } from "@utils/http/index";
import { Key } from "react"

//引入类型:
import type {
    getHosSetListParamsType,     //获取分页列表参数类型 
    getHosSetListReturnType,     //获取分页列表返回值类型 
    addHospitalParamType,        //添加医院参数的类型
    getHosSetListItemsType,      //根据id获取医院返回值类型 
    updateHospitalParamType,     //修改医院的参数的类型
} from '@api/hospital/model/hospitalSetTypes'


//医院设置中 获取分页列表请求
export const getHosSetListRequest = ({ page, limit, hosname, hoscode }:getHosSetListParamsType) => {
    return request.get<any , getHosSetListReturnType>(`/admin/hosp/hospitalSet/${page}/${limit}`,{
        params: {
            hosname,
            hoscode
        }
    })
}


//医院设置中 添加医院请求
export const addHospitalRequest = (data:addHospitalParamType) => {
    return request.post<any , null>("/admin/hosp/hospitalSet/save" , data)
}


//医院设置中 根据id获取某个医院的详细信息
export const getHosSetFromIDRequest = (id:string) => {
    return request.get<any , getHosSetListItemsType>(`/admin/hosp/hospitalSet/get/${id}`)
}

//医院设置中 修改医院请求
export const upDateHospitalRequest = (data:updateHospitalParamType) => {
    return request.put<any , null>("/admin/hosp/hospitalSet/update" , data)
}


//医院设置中 删除医院请求
export const deleteHospitalSetRequest = (id:number) => {
    return request.delete<any , null>(`/admin/hosp/hospitalSet/remove/${id}`)
}

//医院设置中 批量删除医院请求
export const deleteAllHospitalSetRequest = (ids:Key[]) => {
    return request.delete<any , null>("/admin/hosp/hospitalSet/batchRemove" , {
        data: ids
    })
}
